package com.hippoDocker.feign.controller;

import com.hippoDocker.commons.entities.CommonResult;
import com.hippoDocker.feign.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName PaymentController
 * @Description TODO OpenFeign测试
 * @Author hippoDocker
 * @Date 2022/6/15 10:36
 **/
@RestController
@RequestMapping("/payment")
@Slf4j
public class OrderFeignController {
    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/getPaymentById/{id}")
    public CommonResult getPaymentById(@PathVariable("id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping("/feign/timeout")
    public String paymentFeignTimeOut(){
        //openfeign-ribbon，客户端一殷默认等待1秒钟
        return paymentFeignService.paymentFeignTimeOut();
    }
}
